package com.example.shop_2212.adapter

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.base.entity.Goods
import com.example.shop_2212.R
import com.example.shop_2212.utils.GlideUtils

class GoodsMutAdapter:BaseMultiItemQuickAdapter<Goods,BaseViewHolder>() {
    init {
        addItemType(0, R.layout.item_goods)
        addItemType(1, R.layout.item_goods)
    }
    override fun convert(holder: BaseViewHolder, item: Goods) {
        if(holder.itemViewType==0){
            GlideUtils.loadCornerImage(context,item.image,holder.getView(R.id.goods_iv),20)
        }else{
            GlideUtils.loadCircleImage(context,item.image,holder.getView(R.id.goods_iv))
        }
        holder.setText(R.id.goods_name,item.storeName)
        holder.setText(R.id.goods_price,"￥${item.price}")
        holder.setText(R.id.goods_num,"已售${item.sales+item.ficti}件")
    }
}